/**
 * 
 */
package org.insia.smartposse.metier.webservice;

import java.io.Serializable;
import java.util.ArrayList;
import java.util.List;

import org.insia.smartposse.metier.Freelance;
import org.insia.smartposse.metier.FreelanceAlert;
import org.insia.smartposse.metier.FreelancePortfolio;
import org.insia.smartposse.metier.FreelanceSkill;
import org.insia.smartposse.metier.Project;

/**
 * @author raguerri
 * @since 18 avr. 07
 * @version 0.0.1
 * 
 */
public class LightFreelance 
extends LightUser 
implements Serializable {
	
	/**
	 * 
	 */
	private static final long serialVersionUID = -7555669195057368076L;
	private double fee;
	private String description;
	
	private List<LightFreelanceSkill> skillSet = new ArrayList<LightFreelanceSkill>();
	private List<LightFreelancePortfolio> portfolioSet = new ArrayList<LightFreelancePortfolio>();
	private List<LightFreelanceAlert> alertSet = new ArrayList<LightFreelanceAlert>();
	
	/**
	 * 
	 *
	 */
	public LightFreelance() {
	}
	
	/**
	 * 
	 * @param freelance
	 */
	public LightFreelance (Freelance freelance) {
		id = freelance.getId();
		fee = freelance.getFee();
		gender = freelance.getGender();
		
		login = freelance.getLogin();
		password = freelance.getPassword();
		firstName = freelance.getFirstName();
		lastName = freelance.getLastName();
		email = freelance.getEmail();
		description = freelance.getDescription() != null ? freelance.getDescription() : "";
		
		type = 'f';
		
		if (freelance.getProjectSet().size() != 0) {
			for (Project proj : freelance.getProjectSet()) {
				projectSet.add(proj.setLight());
			}
		}
		
		if (freelance.getSkillSet().size() != 0) {
			for (FreelanceSkill fskill : freelance.getSkillSet()) {
				skillSet.add(fskill.setLight());
			}
		}
		
		if (freelance.getPortfolioSet().size() != 0) {
			for (FreelancePortfolio fportfolio : freelance.getPortfolioSet()) {
				portfolioSet.add(fportfolio.setLight());
			}
		}
		
		if (freelance.getAlertSet().size() != 0) {
			for (FreelanceAlert falert : freelance.getAlertSet()) {
				alertSet.add(falert.setLight());
			}
		}
	}

	/**
	 * @return the alertSet
	 */
	public List<LightFreelanceAlert> getAlertSet() {
		return alertSet;
	}

	/**
	 * @return the fee
	 */
	public double getFee() {
		return fee;
	}

	/**
	 * @return the description
	 */
	public String getDescription() {
		return description;
	}

	/**
	 * @return the portfolioSet
	 */
	public List<LightFreelancePortfolio> getPortfolioSet() {
		return portfolioSet;
	}

	/**
	 * @return the skillSet
	 */
	public List<LightFreelanceSkill> getSkillSet() {
		return skillSet;
	}

	/**
	 * @param alertSet the alertSet to set
	 */
	public void setAlertSet(List<LightFreelanceAlert> alertSet) {
		this.alertSet = alertSet;
	}

	/**
	 * @param description the description to set
	 */
	public void setDescription(String description) {
		this.description = description;
	}

	/**
	 * @param fee the fee to set
	 */
	public void setFee(double fee) {
		this.fee = fee;
	}

	/**
	 * @param portfolioSet the portfolioSet to set
	 */
	public void setPortfolioSet(List<LightFreelancePortfolio> portfolioSet) {
		this.portfolioSet = portfolioSet;
	}

	/**
	 * @param skillSet the skillSet to set
	 */
	public void setSkillSet(List<LightFreelanceSkill> skillSet) {
		this.skillSet = skillSet;
	}
}
